package com.sqf.soft.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class CommonUtils {

    private final static int min = 10000;
    private final static int max = 100000;

    public static boolean isBlank(final CharSequence cs) {
        int strLen;
        if (cs == null || (strLen = cs.length()) == 0) {
            return true;
        }
        for (int i = 0; i < strLen; i++) {
            if (!Character.isWhitespace(cs.charAt(i))) {
                return false;
            }
        }
        return true;
    }

    public static String createKeyId() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String datetime = sdf.format(new Date());
        StringBuilder sb = new StringBuilder();
        sb.append(datetime);
        int current = (int) Math.floor(Math.random() * (max - min) + min);
        sb.append(current);
        return sb.toString();
    }
}
